//
//  KZVocabularyImproveMakeTestVC.m
//  听说弱点强化训练
//
//  Created by 朱凯 on 2018/8/22.
//  Copyright © 2018年 盛超. All rights reserved.
//

#import "KZVocabularyImproveMakeTestVC.h"

// view
#import "KZVocabularyImproveTitleView.h"

@interface KZVocabularyImproveMakeTestVC ()

@property (nonatomic, strong) KZVocabularyImproveTitleView *titleView;
@property (nonatomic, strong) UILabel *packageRecordLabel;
@end

@implementation KZVocabularyImproveMakeTestVC

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setupNaviUI];
    [self setupUI];
}
- (void)setupNaviUI {
    
    NSString *text = @"听说词汇强化学习";
    UIControl *backControl = [[UIControl alloc] initWithFrame:CGRectMake(0, 0, 15 + 10 + [text getSizeOfBlodString:18].width, 44)];
    [backControl addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    //
    UIImageView *backIconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 15, 25)];
    backIconView.image = [UIImage imageNamed:@"back"];
    backIconView.centerY = backControl.height / 2;
    [backControl addSubview:backIconView];
    //
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, [text getSizeOfBlodString:18].width + 5, 44)];
    label.adjustsFontSizeToFitWidth = true;
    label.text = @"听说词汇强化学习";
    label.font = B_FONT(18);
    label.textAlignment = NSTextAlignmentLeft;
    label.textColor = [UIColor whiteColor];
    [backControl addSubview:label];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backControl];
}
- (void)setupUI {
    
    // 记录题目index，时长等
    _titleView = [KZVocabularyImproveTitleView new];
    [self.view addSubview:_titleView];
    [_titleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(@0);
        make.height.equalTo(@40);
    }];
    
    // 包记录(几/几)
    _packageRecordLabel = [[UILabel alloc] init];
    _packageRecordLabel.text = @"第1个包/共8个包";
    _packageRecordLabel.font = FONT(14);
    _packageRecordLabel.textAlignment = NSTextAlignmentLeft;
    _packageRecordLabel.textColor = [UIColor lightGrayColor];
    [self.view addSubview:_packageRecordLabel];
    [_packageRecordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.top.equalTo(_titleView.mas_bottom);
        make.height.equalTo(_titleView);
    }];
}
#pragma mark - 事件
- (void)back {
    
    [self dismissViewControllerAnimated:true completion:nil];
}
@end
